package com.example.course.controller.admin;

import com.example.course.dto.admin.AdminCategoryRemoveDto;
import com.example.course.dto.admin.AdminCategorySaveDto;
import com.example.course.service.CategoryService;
import com.example.course.utils.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/category")
public class AdminCategoryController {

    @Autowired
    private CategoryService categoryService;

    @PostMapping("/save_category")
    public Result saveCategory(@RequestBody AdminCategorySaveDto dto){
        return categoryService.saveCategory(dto);
    }

    @GetMapping("/remove_category")
    public Result removeCategory(@RequestParam("id") Long id){
        return categoryService.removeCategory(id);
    }

    @PostMapping("/get_category_list")
    public Result getAdminCategory(@RequestBody AdminCategoryRemoveDto dto){
        return categoryService.getAdminCategory(dto);
    }

}
